<template>
  <div>
    <keep-alive>
      <component v-bind:is="page"></component>
    </keep-alive>
  </div>
</template>

<script>
import bus from '../../assets/eventBus'
import UserList from './MainPage/UserList'
import test from './MainPage/test'
export default {
  name: 'Main',
  data () {
    return {
      page: test
    }
  },
  created () {
    bus.$on('my-id-selected', index => {
      switch (index) {
        case '1-1': {
          this.page = UserList
          break
        }
        case '1-2': {
          this.page = test
          break
        }
      }
    })
  }
}
</script>

<style scoped>

</style>
